<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const curry = (nums, ...arguments) => {
        //获取参数的个数
        const numsL = nums.length
        return (...arguments) => {
          //参数
          getArguments = arguments.concat(arguments)
          // 继续递归搜索
          if (getArguments.length < numsL) {
            return curry.call(this, nums, ...arguments)
          } else {
            nums.apply(this, getArguments)
          }
        }
      }
      const curryAdd = curry((num1, num2, num3) => {
        console.log(num1 + num2 + num3)
      })
      curryAdd(1,2,3)
    </script>
  </body>
</html>
